/* static/css/custom_styles.css */

/* ------------------------- */
/* Global & Typography       */
/* ------------------------- */

:root {
    /* Define custom color variables - can override Bootstrap or add new ones */
    --app-primary: #198754; /* Bootstrap success green */
    --app-primary-darker: #146c43;
    --app-primary-lighter: #badbcc;
    --app-secondary: #6c757d; /* Bootstrap secondary */
    --app-light-gray: #f8f9fa;
    --app-border-color: #dee2e6;
    --app-text-color: #212529;
    --app-link-color: var(--app-primary);
    --app-link-hover-color: var(--app-primary-darker);
    --app-card-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --app-card-shadow-hover: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Helvetica Neue', Arial, sans-serif; /* Cleaner font stack */
    background-color: var(--app-light-gray); /* Slightly off-white background */
    color: var(--app-text-color);
    padding-top: 70px; /* Increased padding for slightly taller navbar */
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 500; /* Slightly lighter heading weight */
    color: var(--app-primary-darker); /* Darker green for headings */
}

h1.h2, h2.h3 { /* Adjust Bootstrap heading classes if needed */
    font-weight: 500;
}

a {
    color: var(--app-link-color);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

a:hover {
    color: var(--app-link-hover-color);
    text-decoration: underline;
}

/* ------------------------- */
/* Navbar                    */
/* ------------------------- */

.navbar.bg-success {
    background-color: var(--app-primary) !important; /* Ensure our primary color is used */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15); /* Slightly stronger shadow */
    padding-top: 0.8rem;
    padding-bottom: 0.8rem; /* Make navbar slightly taller */
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.4rem; /* Slightly larger brand */
}

.navbar .nav-link {
    font-size: 1rem; /* Standard nav link size */
    padding: 0.5rem 1rem;
    transition: background-color 0.2s ease;
    border-radius: 4px; /* Slight rounding */
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.15); /* Subtle background on hover/active */
}

.navbar .dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.175); /* Standard Bootstrap dropdown shadow */
    margin-top: 0.5rem; /* Add slight space between navbar and dropdown */
}

.navbar .dropdown-item {
    padding: 0.5rem 1rem;
}
.navbar .dropdown-item i {
    margin-right: 0.5rem;
    width: 1.2em; /* Align icons */
    text-align: center;
}

/* ------------------------- */
/* Cards                     */
/* ------------------------- */

.card {
    border: 1px solid var(--app-border-color);
    border-radius: 0.375rem; /* Bootstrap default */
    box-shadow: var(--app-card-shadow);
    transition: box-shadow 0.3s ease-in-out;
    margin-bottom: 1.5rem; /* Consistent bottom margin */
}

.card:hover {
     box-shadow: var(--app-card-shadow-hover); /* Enhance shadow on hover */
}

.card-header {
    background-color: #ffffff; /* White card header */
    border-bottom: 1px solid var(--app-border-color);
    font-weight: 600; /* Bolder header */
    color: var(--app-primary-darker);
    padding: 0.75rem 1.25rem; /* Standard padding */
}

.card-title {
    color: var(--app-primary-darker); /* Match header color */
}

/* ------------------------- */
/* List Group Items (Fields/Records List) */
/* ------------------------- */

.list-group-item-action {
    transition: background-color 0.2s ease, border-left 0.2s ease;
    border-left: 4px solid transparent; /* Prepare for hover effect */
    padding: 1rem 1.25rem; /* Adjust padding */
}

.list-group-item-action:hover,
.list-group-item-action:focus {
    background-color: #eef6f2; /* Very light green background on hover */
    border-left-color: var(--app-primary); /* Add accent border on hover */
    color: var(--app-text-color); /* Keep text color consistent */
    text-decoration: none;
}

.list-group-item h5 {
    margin-bottom: 0.3rem; /* Adjust spacing in list items */
}

.list-group-item p {
    margin-bottom: 0.2rem;
    font-size: 0.9rem; /* Slightly smaller descriptive text */
}

.list-group-item small.text-muted {
    font-size: 0.8rem; /* Smaller meta text */
}

/* ------------------------- */
/* Buttons                   */
/* ------------------------- */

.btn {
    border-radius: 0.25rem; /* Slightly less rounding */
    padding: 0.5rem 1rem; /* Slightly larger padding */
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.btn-primary, .btn-success {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
}
.btn-primary:hover, .btn-success:hover {
    background-color: var(--app-primary-darker);
    border-color: var(--app-primary-darker);
}
/* Ensure consistency if using btn-primary and btn-success */
.btn-primary { background-color: var(--app-primary); border-color: var(--app-primary); }
.btn-primary:hover { background-color: var(--app-primary-darker); border-color: var(--app-primary-darker); }

.btn-outline-primary { border-color: var(--app-primary); color: var(--app-primary); }
.btn-outline-primary:hover { background-color: var(--app-primary); color: white; }

.btn-outline-danger { border-color: #dc3545; color: #dc3545; }
.btn-outline-danger:hover { background-color: #dc3545; color: white; }

.btn i {
    margin-right: 0.4rem; /* Space between icon and text in buttons */
    vertical-align: middle; /* Align icons nicely */
    margin-top: -2px; /* Fine-tune vertical alignment */
}

.btn-sm i {
    margin-right: 0.3rem;
}

/* ------------------------- */
/* Forms                     */
/* ------------------------- */

/* Crispy forms uses form-control, form-select, etc. classes */
.form-control,
.form-select {
    border: 1px solid #ced4da;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-primary-lighter); /* Light green border on focus */
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25); /* Green glow on focus */
}

/* Style required field labels generated by crispy forms or manually */
label.required::after {
    content: " *";
    color: #dc3545; /* Bootstrap danger color for asterisk */
    font-weight: bold;
    margin-left: 2px;
}

/* Adjust textarea height if needed */
textarea.form-control {
    min-height: 80px; /* Ensure textarea has a decent minimum height */
}

/* Date inputs - ensure they don't look too different */
input[type="date"].form-control {
    /* Appearance might vary by browser, difficult to style consistently */
    padding-right: 0.75rem; /* Adjust padding if needed */
}

/* ------------------------- */
/* Alerts / Messages         */
/* ------------------------- */

.alert {
    display: flex; /* Align icon and text nicely */
    align-items: center;
    border-left-width: 4px; /* Add thicker left border */
    border-radius: 0.25rem;
}

.alert .bi { /* Icon styling within alerts */
    margin-right: 0.75rem;
    font-size: 1.2rem;
}

.alert-success { border-left-color: var(--app-primary); }
.alert-danger { border-left-color: #dc3545; }
.alert-warning { border-left-color: #ffc107; }
.alert-info { border-left-color: #0dcaf0; }

/* ------------------------- */
/* Pagination                */
/* ------------------------- */

.pagination .page-link {
    color: var(--app-primary);
    transition: all 0.2s ease;
}

.pagination .page-link:hover {
    background-color: #eef6f2; /* Light green background */
    color: var(--app-primary-darker);
}

.pagination .page-item.active .page-link {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: #adb5bd; /* Lighter color for disabled */
}

/* ------------------------- */
/* Responsive Adjustments    */
/* ------------------------- */

/* Example: Reduce padding on smaller screens */
@media (max-width: 767.98px) {
    body {
        padding-top: 65px; /* Adjust if navbar height changes */
    }

    .container, .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    h1, .h1 { font-size: 1.75rem; }
    h2, .h2 { font-size: 1.5rem; }

    .card-header, .card-body {
        padding: 0.75rem 1rem; /* Slightly reduce card padding */
    }

    .list-group-item-action {
         padding: 0.75rem 1rem;
    }

    .btn {
        padding: 0.4rem 0.8rem; /* Slightly smaller buttons */
        font-size: 0.9rem;
    }

    /* Adjust flex layouts if needed */
    .d-flex.flex-wrap {
        /* Ensure elements stack nicely */
    }
}

/* Example: Further adjustments for very small screens */
@media (max-width: 575.98px) {
    body {
        padding-top: 60px;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }

    /* Stack buttons in detail views maybe */
    .d-flex.justify-content-between .btn-group {
        width: 100%;
        margin-top: 0.5rem;
        display: flex;
        justify-content: space-evenly;
    }
    .d-flex.justify-content-between .btn-group .btn {
        flex-grow: 1;
        margin: 0 2px;
    }
}


/* ------------------------- */
/* Footer                    */
/* ------------------------- */
footer.bg-light {
    padding: 1.5rem 0;
    font-size: 0.9em;
    border-top: 1px solid var(--app-border-color);
}